/*  
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sdd.facades.view;

import com.sdd.facades.business.CategoryBusinessFacadeBean;
import com.sdd.facades.factories.CategoryFactoryFacadeBean;
import com.sdd.plains.CategoryPlain;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;

/**
 *
 * @author tpgalan
 */
@Stateless
public class CategoryViewFacadeBean implements CategoryViewFacade{

    @EJB
    CategoryBusinessFacadeBean categoryBusinessFacadeBean;
    @EJB
    CategoryFactoryFacadeBean categoryFactoryFacadeBean;
    
    @Override
    public CategoryPlain getCategory(long categoryId) {
        return categoryFactoryFacadeBean.createCategoryPlain(categoryBusinessFacadeBean.getCategory(categoryId));
    }

    @Override
    public CategoryPlain addCategory(CategoryPlain categoryPlain) {
        return categoryFactoryFacadeBean.createCategoryPlain(categoryBusinessFacadeBean.addCategory(categoryPlain));
    }

    @Override
    public CategoryPlain addCategoryWithFather(CategoryPlain categoryPlain, CategoryPlain father) {
        return categoryFactoryFacadeBean.createCategoryPlain(categoryBusinessFacadeBean.addCategoryToCategory(categoryPlain,father));
    }

    @Override
    public List<CategoryPlain> getAllMainCategories() {
        return categoryFactoryFacadeBean.createCategoriesPlains(categoryBusinessFacadeBean.getAllMainCategories());
    }

    @Override
    public List<CategoryPlain> getAllMainCategoriesWithCB() {
        return categoryFactoryFacadeBean.createCategoriesPlains(categoryBusinessFacadeBean.getAllMainCategoriesWithCB());
    }

    @Override
    public List<CategoryPlain> getChildCategories(CategoryPlain cp) {
        return categoryFactoryFacadeBean.createCategoriesPlains(categoryBusinessFacadeBean.getChildCategories(cp.getCategoryId()));
    }

    @Override
    public CategoryPlain getCategory(String name) {
        return categoryFactoryFacadeBean.createCategoryPlain(categoryBusinessFacadeBean.getCategory(name));
    }

    

    
    
}
